package com.ibeeking.found.open.api.feign;

import com.ibeeking.found.open.api.common.dto.GoodsInfoDTO;
import com.ibeeking.found.open.api.common.dto.GoodsListDTO;
import com.ibeeking.found.open.api.common.query.GoodsIdQuery;
import com.ibeeking.found.open.api.common.query.GoodsListQuery;
import com.ibeeking.found.open.api.feign.fallback.GoodsFeignFallbackFactory;
import com.ibeeking.nematos.utils.base.page.Page;
import com.ibeeking.nematos.utils.result.ResponseResult;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;


/**
 * @Author ibeeking
 */
@FeignClient(name = "mall-goods-c-server", path = "/c", contextId = "openGoodsFeignClient", fallbackFactory = GoodsFeignFallbackFactory.class, decode404 = true)
public interface GoodsFeignClient {

    /**
     * 商品分页
     *
     * @param query
     * @return
     */
    @PostMapping(value = "/open/goods/feign/v1/api/goodsPageList")
    ResponseResult<Page<GoodsListDTO>> apiGoodsPageList(@Validated @RequestBody GoodsListQuery query);

    /**
     * 根据商品id查询商品信息
     *
     * @param goodsId
     * @return
     */
    @PostMapping(value = "/open/goods/feign/v1/api/goodsInfo/{goodsId}")
    ResponseResult<GoodsInfoDTO> apiGoodsInfo(@PathVariable("goodsId") Long goodsId);

    /**
     * api 查询已上架的最早的大码商品id
     *
     * @param query
     * @return
     */

    @PostMapping(value = "/open/goods/feign/v1/api/oneOnShelfLargeSizeGoodsId")
    ResponseResult<Long> oneOnShelfLargeSizeGoodsId(@RequestBody GoodsIdQuery query);
}
